package com.yx.fx.webApi.controller;


import com.yx.fx.common.model.response.Outcome;
import com.yx.fx.webApi.param.BankAccessRecordParam;
import com.yx.fx.webApi.serviceImpl.BankAccessRecordServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author pxb
 * @since 2021-09-17
 */
@RestController
@RequestMapping("/bankAccessRecord")
public class BankAccessRecordController {

    @Resource
    private BankAccessRecordServiceImpl bankAccessRecordServiceImpl;


    @ApiOperation("新增")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public Outcome save(@RequestBody @Valid BankAccessRecordParam param) {
        return bankAccessRecordServiceImpl.save(param);
    }

    @ApiOperation("更新内容")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Outcome update(@RequestBody @Valid BankAccessRecordParam param) {
        return bankAccessRecordServiceImpl.updateById(param);
    }

    @ApiOperation("根据走访信息id获取走访记录")
    @RequestMapping(value = "/getListByBankAccId/{id}", method = RequestMethod.POST)
    public Outcome getListByBankAccId(@PathVariable Integer id) {
        if (id == null) {
            Outcome.failure("参数异常");
        }
        return bankAccessRecordServiceImpl.getListByBankAccId(id);
    }


}

